The lazy evaluation feature is needed to handle recursive data structures like trees and graphs 懶惰求值的特性常用在處理像tree或者graph這樣的遞歸數(shù)據(jù)結(jié)構(gòu)上。
One example of a lazy evaluation is a function that generates an infinite list of fibonacci numbers, but where the computation of the 一個(gè)懶惰計(jì)算的例子是生成無(wú)窮fibonacci列表的函數(shù),但是對(duì)第n個(gè)
In lazy evaluation, an expression is not evaluated as soon as it is bound to a variable, but when the evaluator is forced to produce the expression s value 在懶惰計(jì)算中,表達(dá)式不是在綁定到變量時(shí)立即計(jì)算,而是在求值程序需要產(chǎn)生表達(dá)式的值時(shí)進(jìn)行計(jì)算。